
/*
 * Copyright (C) 2008-2009 Archie L. Cobbs. All rights reserved.
 *
 * $Id: FieldModelSwitchAdapter.java 173 2009-11-10 17:08:19Z archie.cobbs $
 */

package org.dellroad.sidekar.schema.model;

/**
 * Adapter class for {@link FieldModelSwitch} implementations.
 */
public class FieldModelSwitchAdapter<R> implements FieldModelSwitch<R> {

    /**
     * This implementation delegates to {@link #caseSimpleFieldModel}.
     */
    @Override
    public R caseReferenceFieldModel(ReferenceFieldModel fieldModel) {
        return caseSimpleFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseCollectionFieldModel}.
     */
    @Override
    public R caseSetFieldModel(SetFieldModel fieldModel) {
        return caseCollectionFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseComplexFieldModel}.
     */
    @Override
    public R caseMapFieldModel(MapFieldModel fieldModel) {
        return caseComplexFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseCollectionFieldModel}.
     */
    @Override
    public R caseListFieldModel(ListFieldModel fieldModel) {
        return caseCollectionFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseAtomicFieldModel}.
     */
    @Override
    public R caseStringFieldModel(StringFieldModel fieldModel) {
        return caseAtomicFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseAtomicFieldModel}.
     */
    @Override
    public R caseDateFieldModel(DateFieldModel fieldModel) {
        return caseAtomicFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseAtomicFieldModel}.
     */
    @Override
    public R caseBigIntegerFieldModel(BigIntegerFieldModel fieldModel) {
        return caseAtomicFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseSimpleFieldModel}.
     */
    @Override
    public R caseArrayFieldModel(ArrayFieldModel fieldModel) {
        return caseSimpleFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseAtomicFieldModel}.
     */
    @Override
    public R caseBooleanFieldModel(BooleanFieldModel fieldModel) {
        return caseAtomicFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseAtomicFieldModel}.
     */
    @Override
    public R caseByteFieldModel(ByteFieldModel fieldModel) {
        return caseAtomicFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseAtomicFieldModel}.
     */
    @Override
    public R caseCharacterFieldModel(CharacterFieldModel fieldModel) {
        return caseAtomicFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseAtomicFieldModel}.
     */
    @Override
    public R caseShortFieldModel(ShortFieldModel fieldModel) {
        return caseAtomicFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseAtomicFieldModel}.
     */
    @Override
    public R caseIntegerFieldModel(IntegerFieldModel fieldModel) {
        return caseAtomicFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseAtomicFieldModel}.
     */
    @Override
    public R caseFloatFieldModel(FloatFieldModel fieldModel) {
        return caseAtomicFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseAtomicFieldModel}.
     */
    @Override
    public R caseDoubleFieldModel(DoubleFieldModel fieldModel) {
        return caseAtomicFieldModel(fieldModel);
    }

    /**
     * This implementation delegates to {@link #caseAtomicFieldModel}.
     */
    @Override
    public R caseLongFieldModel(LongFieldModel fieldModel) {
        return caseAtomicFieldModel(fieldModel);
    }

    /**
     * Internal roll-up method.
     * This implementation delegates to {@link #caseSimpleFieldModel}.
     */
    protected R caseAtomicFieldModel(AtomicFieldModel fieldModel) {
        return caseSimpleFieldModel(fieldModel);
    }

    /**
     * Internal roll-up method.
     * This implementation delegates to {@link #caseDefault}.
     */
    protected R caseSimpleFieldModel(SimpleFieldModel fieldModel) {
        return caseDefault(fieldModel);
    }

    /**
     * Internal roll-up method.
     * This implementation delegates to {@link #caseComplexFieldModel}.
     */
    protected R caseCollectionFieldModel(CollectionFieldModel fieldModel) {
        return caseComplexFieldModel(fieldModel);
    }

    /**
     * Internal roll-up method.
     * This implementation delegates to {@link #caseDefault}.
     */
    protected R caseComplexFieldModel(ComplexFieldModel fieldModel) {
        return caseDefault(fieldModel);
    }

    /**
     * Internal roll-up method.
     * This implementation just returns null.
     */
    protected R caseDefault(FieldModel fieldModel) {
        return null;
    }
}

